# Contributor: Tom Parker-Shemilt <palfrey@tevp.net>
# Maintainer: Tom Parker-Shemilt <palfrey@tevp.net>
pkgname=netpbm
pkgver=10.73.30
pkgrel=0
pkgdesc="A toolkit for manipulation of graphic images"
url="http://netpbm.sourceforge.net/"
arch="all"
license="IJG AND BSD-3-Clause AND GPL-2.0-only"
depends="libpng libjpeg-turbo tiff zlib"
makedepends="perl libpng-dev libjpeg-turbo-dev tiff-dev zlib-dev libx11-dev sed flex"
subpackages="$pkgname-static $pkgname-dev $pkgname-doc"
source="http://downloads.sourceforge.net/netpbm/super_stable/netpbm-$pkgver.tgz
	config.mk
	01-makefile.patch
	02-installnetpbm.patch
	"

build() {
	cat config.mk.in "$srcdir"/config.mk > config.mk
	make
	make package pkgdir="$(pwd)/pkgdir"
}

package() {
	mkdir -p $pkgdir/usr/bin/ \
		$pkgdir/usr/share/man/man1 \
		$pkgdir/usr/share/man/man3 \
		$pkgdir/usr/share/man/man5 \
		$pkgdir/usr/share/man/web \
		$pkgdir/usr/lib/pkgconfig
	BUILDDIR="$builddir" PKGDIR="$pkgdir" ./installnetpbm
	install -Dm644 $builddir/doc/copyright_summary "$pkgdir"/usr/share/licenses/$pkgname/COPYING
	sed -i "s,$pkgdir,,g" "$pkgdir/usr/lib/pkgconfig/netpbm.pc"
	sed -i "s/Version: Netpbm $pkgver/Version: $pkgver/" "$pkgdir/usr/lib/pkgconfig/netpbm.pc"
}

sha512sums="a04dc530df98cd1265b6fe9ecb8e37613bea55a89a20d47f7fb52a8c7a1e733650f53f320a807cd785ff170b320c03fbabf6e29b7a274d4d5f73281f45cf23bc  netpbm-10.73.30.tgz
07e87947e71fe5831ffb7740df051b66eacef45892f6c28e337882a28b47b87ab15252cf2ae51c3208fb80523539ad7996136d09f436f32c2dc2bd4be24549d0  config.mk
85d78938cf825fdca5c43a40ab25a147ae42e7b78f61ffb73082b64edb3a7127d2197971b9bdbf1011ef8ba20a55acce84b5dc8fba43b603f8faa33abeb761bb  01-makefile.patch
e863fba8eec7551179eb96246abd9e3af1bfacf5dbb029a9a2c4d4af00bc6fc6d12e484d422f50d5890993c101b9f060b30c5ca753c4c7ae8577a219649b9dad  02-installnetpbm.patch"
